<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display" %>
<%@ page import="java.util.*"%>
<%@ page import="com.cs.beneficios.business.model.RepDetBOTVO,com.cs.beneficios.business.model.RepAtributoVO"%>

<html>
<head>
<script language="JavaScript" src="<%= request.getContextPath() + "/js/popUP.js" %>"></script>
<link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">

<script language="javascript">
  function buscar(){
    document.frmpermisosreportes.btnasignar.disabled = true;
    document.frmpermisosreportes.action = '<%=request.getContextPath()+"/User/PermissionsReport.do"%>'
    document.frmpermisosreportes.submit();
  }
  
  function buscar1(){  
    if(event.keyCode==13){
      document.frmpermisosreportes.action = '<%=request.getContextPath()+"/User/PermissionsReport.do"%>'
      document.frmpermisosreportes.submit();
    }
  }
  
  function activar(){  
      document.frmpermisosreportes.btnasignar.disabled = false;
  }
  
  function validarOtros(tamano)
  {
    var nom = "";
    var marcado = false;
    for (i = 0; i < tamano; i++) 
    {
      nom = "codeusuario"+i;
      if (document.forms['frmpermisosreportes'].elements[nom].checked) 
      {
        marcado = true;
        break;
      }  
    } 
    if (marcado == false)
    {
      alert('Por favor seleccione una opcion.');
    }else
    {
      document.frmpermisosreportes.submit();
    }
  }
  
  function enviar(locacion1)
  {
    document.frmpermisosreportes.action=locacion1;
    document.frmpermisosreportes.submit();
  }
    
</script>

<script src="<%=request.getContextPath()%>/js/displaytag.js" type="text/javascript"></script>
</head>
<body>
<form name="frmpermisosreportes" action="<%=request.getContextPath()+"/User/SelectionPermissionReport.do"%>" method="get">
<%
  List lUsuarios = new LinkedList();
  lUsuarios = (List)session.getAttribute("ListaUsuarios");
  int tamano = lUsuarios.size();
%>
<table width="99%"  border="0" cellpadding="0" cellspacing="0" widtd="100%">
 
  <tr> 
    <td height="25" colspan="12" align="center" class="titulosenblanco"><strong> CRITERIOS DE BUSQUEDA DE USUARIOS</strong></td>
  </tr>
  
  <tr align="left"> 
     <td height="25" colspan="12" class="titulosenblanco"><table width="99%" border="0" cellpadding="0" cellspacing="0">
		  
      </table></td>		
  </tr>

  
  
  
  <input type="hidden" name="search" value="search">
  <tr align="left">
    <td width="100%" align="center"> 
		<table width="70%" border="0" cellpadding="3" cellspacing="3">
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%" align="left" class="celdatabla"><strong>Usuario</strong> 
            </td>
          <td width="61%">
            <input type="text" name="nameuser" onkeypress="buscar1()"/>
          </td>
          <td width="10%">&nbsp;</td>
        </tr>
        
        <tr> 
          <td width="7%">&nbsp;</td>
          
          
          <td width="10%">&nbsp;</td>
        </tr>
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%">&nbsp;</td>
          <td width="61%"><input type="button" name="Submit" onclick="buscar()" value="Buscar"> </td>
          <td width="10%">&nbsp;</td>
        </tr>
        <tr> 
          <td colspan="4">&nbsp;</td>
        </tr>
        <tr> 
          <td width="7%">&nbsp;</td>
          <td width="22%">&nbsp;</td>
          <td width="61%">&nbsp;</td>
          <td width="10%">&nbsp;</td>
        </tr>
      </table>
	</td>
  </tr>

  
  
  
  
  <tr> 
    <td colspan="12" align="left">
	<logic:present name="ListaUsuarios"> 
	
	    <%int p = 0;%>
      <display:table name="sessionScope.ListaUsuarios" id="Usuario" pagesize="20" cellpadding="3" cellspacing="1" style="width:100%" class="bordestable">
			
			<display:column headerClass="headerTable" title="NOMBRE" class="Numero" sortable="true" property="nombreUsuario"></display:column>	
			<display:column headerClass="headerTable" title="DESCRIPCION" class="Numero" sortable="true" property="descripcion"></display:column>	
      <display:column headerClass="headerTable" title="GRUPO USUARIO" class="Numero" sortable="true" property="nombreGrupo"></display:column>	
      <display:column headerClass="headerTable" title="SELECCIONAR" >
          <DIV align="center">
          <bean:define name="Usuario" id="Usuarios" property="codeUsuario"></bean:define>
          <%String nom = Usuarios+"";
            String nameus = "codeusuario"+p;
            p+=1;
          %>
          <input type="checkbox" onclick="activar()" name="<%=nameus%>" value="<%=nom%>"/>     
          </DIV>
			</display:column>	
			
		</display:table>
		</logic:present>
		</td>
  </tr>
</table>

<P align="center">
  <input disabled="disabled" type="button" value="Continuar" onclick="validarOtros(<%=tamano%>)" name="btnasignar"/>
</P>
<%String Ruta2 = "'"+request.getContextPath() + "/admin/manageUsers.do'";%>
  <br/>
  <div align="center">
    <input type="image" onclick="enviar(<%=Ruta2%>)" src="<%= request.getContextPath() + "/images/b_atras.gif"%>"/>
  </div>
</form>
</body>
</html>